# coding=utf-8
import requests

headers = {
    "User-Agent": "Mozilla/5.0 (Linux; Android 5.1.1; Nexus 6 Build/LYZ28E) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Mobile Safari/537.36",
    "Content-Type": "application/x-www-form-urlencoded"
}

post_data = {
    "phone": "13113777555",
    "pwd": "1234567890"
}

post_url = "https://api.xdclass.net/pub/api/v1/web/web_login"

session = requests.session()
r = session.post(post_url,headers=headers,data=post_data)
print(r.content.decode())

h = {"token":"xdclasseyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ4ZGNsYXNzIiwicm9sZXMiOiIxIiwiaW1nIjoiaHR0cHM6Ly94ZC12aWRlby1wYy1pbWcub3NzLWNuLWJlaWppbmcuYWxpeXVuY3MuY29tL3hkY2xhc3NfcHJvL2RlZmF1bHQvaGVhZF9pbWcvMjEuanBlZyIsImlkIjo2NzUwMjIsIm5hbWUiOiJkYXNkYWRhc2QxMTEiLCJpYXQiOjE2MTUyNzgzNDksImV4cCI6MTYxNTg4MzE0OX0.rjNp4ULEm_9WnA5Qf8BXsjHj1GuTUCDUP8elOWmnYwc"
}
# "https://api.xdclass.net/pub/api/v1/web/user_info"
response = session.get("https://xdclass.net/#/personalcenter",headers=h)
with open("xdclass4.html","w", encoding="utf-8") as file:
    file.write(response.content.decode("utf-8"))
